<% layout('/layouts/default.html', {title: '财务管理管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> 财务管理管理
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
				<% if(hasPermi('fm:smFinancialManagement:edit')){ %>
					<a href="${ctx}/fm/smFinancialManagement/form" class="btn btn-default btnTool" title="新增财务管理"><i class="fa fa-plus"></i> 新增</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${smFinancialManagement}" action="${ctx}/fm/smFinancialManagement/listData" method="post" class="form-inline"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">所属驾校：</label>
					<div class="control-inline width-120" >
						<#form:treeselect id="officeId" title="驾校"
							path="officeId" labelPath="office.officeName"
							url="${ctx}/sys/office/treeData" allowClear="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label ">经办人：</label>
					<div class="control-inline width-120">
						<#form:treeselect id="employeeId" title="经办人"
						path="employeeId" labelPath="empUser.userName"
						url="${ctx}/sys/office/treeData?isLoadUser=true"
						class=" required" allowClear="true"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">发生时间：</label>
					<div class="control-inline">
						<#form:input path="paymentTime" readonly="true" maxlength="20" class="form-control Wdate-datetime"
						dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">查询</button>
					<button type="reset" class="btn btn-default btn-sm">重置</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'流水号', name:'serialNum', index:'a.serial_num', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/fm/smFinancialManagement/form?id='+row.id+'" class="btnList" data-title="编辑财务管理">'+(val||row.id)+'</a>';
		}},
		{header:'收支类型', name:'payType', index:'a.pay_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('DSMS_SZLX')}, val, '未知', true);
		}},
		{header:'费用类型', name:'costType', index:'a.cost_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('DSMS_FYLX')}, val, '未知', true);
		}},
		{header:'发生日期', name:'paymentTime', index:'a.payment_time', width:150, align:"center"},
		{header:'发生金额', name:'transactionAmount', index:'a.transaction_amount', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'所属驾校', name:'office.officeName', index:'a.officeId', width:150, align:"left"},
		{header:'经办人', name:'empUser.userName', index:'a.employeeId', width:150, align:"left"},
		{header:'费用说明', name:'costRemark', index:'a.cost_remark', width:150, align:"left"},
		{header:'操作', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('fm:smFinancialManagement:edit')){ %>
				actions.push('<a href="${ctx}/fm/smFinancialManagement/form?id='+row.id+'" class="btnList" title="编辑财务管理"><i class="fa fa-pencil"></i></a>&nbsp;');
				actions.push('<a href="${ctx}/fm/smFinancialManagement/delete?id='+row.id+'" class="btnList" title="删除财务管理" data-confirm="确认要删除该财务管理吗？"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>